var commonjs = require("@rollup/plugin-commonjs");
var configs = require("./rollupConfig/index");
var defaultConfig = {
  format: "iife",
  strict: false,
};

var commonConfig = {
  watch: {
    include: "src/**",
  },
  plugins: [commonjs()],
};
var outputBaseDir = "./src/bundle";
var baseDir = "./src";

var rollupConfigs = [];
configs.forEach((config) => {
  config.files.forEach((file) => {
    rollupConfigs.push({
      input: `${baseDir}${config.dir}/${file}.js`,
      output: {
        file: `${outputBaseDir}${config.dir}/b-${file}.js`,
        name: `${file}`,
        ...defaultConfig,
      },
      ...commonConfig,
    });
  });
});

module.exports = rollupConfigs;
